package com.ambimmort.shj.action.device;

/**
 * Created by zyt on 2015/7/30.
 */

import com.ambimmort.shj.service.device.DeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller("/action/device/create.do")
public class Create {
    @Autowired
    private DeviceService deviceService;
    @RequestMapping("/action/device/create.do")
    @ResponseBody
    public String action_device(
            HttpServletRequest request, @RequestParam("Dev_Name") String Dev_Name, @RequestParam("Dev_IP") String Dev_IP, @RequestParam("Probe_Type") String Probe_Type, @RequestParam("DeploySiteName") String DeploySiteName, @RequestParam("IDC_HouseID") String IDC_HouseID, @RequestParam("description") String description, @RequestParam("result") String result) {
        try {
            deviceService.createDevice(Dev_Name, Dev_IP, Probe_Type, DeploySiteName, IDC_HouseID, description, result);
            return "{\"result\":\"true\"}";
        } catch (Throwable throwable) {
            throwable.printStackTrace();
            return "{\"result\":\"false\"}";
        }

    }
}
